//
//  OrganDetailInfoViewController.m
//  SmartWatch
//
//  Created by zwj on 2022/11/28.
//

#import "OrganDetailInfoViewController.h"

@interface OrganDetailInfoViewController ()

@end

@implementation OrganDetailInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isHideNavigationBar = YES;
    self.view.backgroundColor = BACKGROUNDCOLOR;
    
    UIView *backView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 180)];
    
    [backView az_setGradientBackgroundWithColors:@[[UIColor colorWithRGB:0xC4EFEC alpha:1.0],[UIColor colorWithRGB:0xC4EFEC alpha:0.75],[UIColor colorWithRGB:0xC4EFEC alpha:0]] locations:@[@0.0,@0.2,@1.0] startPoint:CGPointMake(0.5, 0) endPoint:CGPointMake(0.5, 1.0)];
    [self.view addSubview:backView];
    
    MyLinearLayout *navView = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Horz];
    navView.myHorzMargin = 0;
    navView.gravity = MyGravity_Vert_Center | MyGravity_Horz_Between;
    navView.myHeight = 44;
    navView.myTop = StatusBarHeight;
    navView.padding = UIEdgeInsetsMake(0, 15, 0, 15);
    [self.view addSubview:navView];
    
    {
        UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [backBtn setImage:UIImageMake(@"icon_arrow_left") forState:UIControlStateNormal];
        backBtn.mySize = CGSizeMake( 40, 40);
        backBtn.imageEdgeInsets = UIEdgeInsetsMake(10,10,10,10);
        [backBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
        [navView addSubview:backBtn];
        
        UILabel *content = [UILabel createLabelText:@"详情" font:UIFontBoldMake(17) textColor:COLOR1515];
        content.mySize = kAutoSize;
        [navView addSubview:content];
        
        UIButton *right = [UIButton createButtonText :@"     " font:UIFontMake(14) textColor:COLOR1515];
        right.mySize = kAutoSize;
        [navView addSubview:right];
        
    }
}

- (void)initSubviews {
    [super initSubviews];
 
    
    UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, NavigationContentTop, kScreenWidth, kScreenHeight - NavigationContentTop)];
    scrollView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:scrollView];
    
    MyLinearLayout *root = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
    root.myHorzMargin = 15;
    root.myTop = 15;
    root.padding = UIEdgeInsetsMake(15, 15, 15, 15);
    root.backgroundColor = COLOR_4;
    root.layer.cornerRadius = 15;
    root.subviewVSpace = 15;
    [scrollView addSubview:root];
    
    {
        UILabel *title = [UILabel createLabelText:@"额叶区" font:UIFontBoldMake(20) textColor:COLOR1515];
        title.mySize = kAutoSize;
        [root addSubview:title];
        
        [root addSubview:[self setAddLineTop:0]];
        
        NSArray *array = @[@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@""];
        for (int i = 0; i < array.count; i++) {
            MyLinearLayout *item = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
            item.myHorzMargin = 0;
            item.myHeight = kAutoHeight;
            item.subviewVSpace = 10;
            item.myTop = 10;
            [root addSubview:item];
            
            
            
            UILabel *name = [UILabel createLabelText:@"营养补充建议" font:UIFontBoldMake(16) textColor:COLOR1515];
            
            CGFloat width = [name sizeThatFits:CGSizeMake(name.preferredMaxLayoutWidth,CGFLOAT_MAX)].width;
            UIView *line = [UIView new];
            line.useFrame = YES;
            [line az_setGradientBackgroundWithColors:@[HexColor(@"#86F1E8"),HexColor(@"#ABE1FF")] locations:@[@0.0,@1.0] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 1)];
            [item addSubview:line];
            [line mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(item);
                make.top.mas_equalTo(item.mas_top).offset(15);
                make.size.equalTo(@(CGSizeMake(width, 6)));
            }];
            
            name.mySize = kAutoSize;
            [item addSubview:name];
            
            
            
            
            UILabel *content = [UILabel createLabelText:@"多摄取蘑菇、豆瓣菜、西兰花、豌豆、小扁豆、西红柿、卷心菜、芹菜、草莓、鸡蛋、南瓜、鳄梨、全麦。与低温w-3油脂。" font:UIFontMake(14) textColor:HexColor(@"454545")];
            content.myHeight = kAutoHeight;
            content.myHorzMargin = 0;
            [item addSubview:content];
        }
    }
}

@end
